function LeftMenu(menuObj, objName) {
	this.menuObj = menuObj;// 初始数据
	this.objName = objName;
	this.objDatas = [];
	this.groupDatas = [];// 整合完成的数据信息，用于存储一些页面上生的id，name......
	this.linkDatas = [];// 用于保存所有的链接的页面元素名称及其父节点的名称
	this.cssStyle = "";
	this.linkFun = null;
	this.preNode = null;
	if (menuObj) {
		this.objDatas = JBF.setObjValue(menuObj.datas, menuObj.datas, "");// 初始化菜单数据
		this.cssStyle = JBF.setObjValue(menuObj.cssStyle, menuObj.cssStyle, "");// 显示的css样式
		if (menuObj.linkFun) {
			this.linkFun = menuObj.linkFun;
		}
	}
}
LeftMenu.prototype = {
	constructor : LeftMenu,
	/**
	 * 以标准的父子关系节点的数据格式的形式来展示
	 * @returns {String}
	 */
	show : function() {
		var menuStr = "<div class='menuPanel'>";
		for ( var i = 0; i < this.objDatas.length; i++) {
			var titleName = "panelTitle_" + i;
			var panelContentName = "panelContentName_" + i;
			var icoName = "panelContentName_ico_" + i;
			var objData = this.objDatas[i];
			var subMenuStr = "<div class='subPanel'><div class='panelTitleOut_expend' name='"
					+ titleName
					+ "' id='"
					+ titleName
					+ "' onclick='"
					+ this.objName + ".extendSubNode(" + i + ");'>";
			subMenuStr += JBF.setObjValue(objData.text,
					"<div class='text'>机构信息</div>", "<div class='text'>"
							+ objData.showName + "</div>");
			subMenuStr += "<div class='ico' id='" + icoName + "' name='"
			+ icoName + "' ></div>";
			subMenuStr += "</div><div isExtend='1' class='panelContent' id='"
					+ panelContentName + "' name='" + panelContentName + "'>";
			this.groupDatas.push({
				"index" : i,
				"titleName" : titleName,
				"contentName" : panelContentName,
				"icoName" : icoName
			});
			if (objData.subNodes) {
				// 用于取最父节点的div名称，用于动态伸缩
				subMenuStr += this.createSubNode(objData, 1, titleName);
			}
			subMenuStr += "</div></div>";
			menuStr += subMenuStr;
		}
		menuStr += "</div>";
		return menuStr;
	},
	/**
	 * 对列表形式数据进行显示
	 */
	showList:function(){
		this.buildMenuTree();
		return this.show();
	},
	buildMenuTree:function () {
		var menuList = this.menuObj.datas;
		var menus = new Array;
		var pSeqno = 0;
		var subSeqno = 0;
	    for (var i = 0; menuList != null && i < menuList.length; i++) {
	    			var md =  menuList[i];
	    			if (md.pmenuId == md.id) {
		    	        menus[pSeqno] = new Object;
		    	        menus[pSeqno].id = md.id;
		    	        menus[pSeqno].code = md.menuCode;
		    	        menus[pSeqno].showName = md.menuName;
		    	        menus[pSeqno].subNodes= new Array;
		    	        pSeqno++;
		    	        md.url = "xxx";
		    	        subSeqno = 0;
	    			} else {
	    				 menus[pSeqno-1].subNodes[subSeqno] = new Object;
	    				 menus[pSeqno-1].subNodes[subSeqno].id=md.id;
	    				 menus[pSeqno-1].subNodes[subSeqno].code= md.menuCode;
	    				 menus[pSeqno-1].subNodes[subSeqno].showName=md.menuName;
	    				 menus[pSeqno-1].subNodes[subSeqno].url = md.url;
	    				 subSeqno++;
	    			}			      
		 }
	    this.menuObj.datas=menus;
	},
	/**
	 * 根据肖前节点的深度及其数据对像用来生成子节点信息
	 * 
	 * @param objData
	 * @param deep
	 * @returns {String}
	 */
	createSubNode : function(objData, deep, parentName) {
		if (objData && objData.subNodes) {
			var className = "subPanelContent";
			if (deep > 1) {
				className = "subPanelContent_";
			}
			var subNodeStr = "<div class='" + className + "'>";
			for ( var i = 0; i < objData.subNodes.length; i++) {
				var subNode = objData.subNodes[i];
				var tabBlack = "";
				var j = 0;
				while (deep > j++) {
					tabBlack += "<div class='block'></div>";
				}
				if (deep < j) {
					tabBlack += "<div class='subIco'></div>";
				}
				13513139725;
				subNodeStr += tabBlack;
				var aName = "linkName_" + subNode.code;
				var callFun=subNode.callFun?subNode.callFun:null;
				subNodeStr += "<a href='javascript:void(0)' name='" + aName
						+ "' id='" + aName + "' code='" + subNode.code
						+ "' class='nodeSelected' onclick='" + this.objName
						+ ".linkFunCall(this,\"" + subNode.url + "\",\""+callFun+"\")'>"
						+ subNode["showName"] + "</a>";
				if (subNode.subNodes) {
					subNodeStr += this.createSubNode(subNode, ++deep);
				}
				this.linkDatas.push({
					"code" : subNode.code,
					"parentName" : parentName,
					"nodeName" : aName
				});
			}
			subNodeStr += "</div>";
			return subNodeStr;
		}
		return "";
	},
	/**
	 * 单击后要执行的操作。同时执行回调函数
	 * 
	 * @param obj
	 * @param url
	 */
	linkFunCall : function(obj, url,callFun) {
		if (this.preNode) {
			this.preNode.style.color = "#000000";
			this.preNode.style.fontSize = "12px";
			this.preNode.style.fontWeight = "";
			this.preNode.style.background = "";
		}
		this.setSelectedCss(obj);
		if(callFun){
			var fun=JBF.strToObj(callFun);
			if(fun){
				alert(fun);
				alert(url);
				fun(url);
				return ;
			}
		}
		this.linkFun(url);
	},
	setSelectedCss:function(obj){
		if(obj!=null){  
			this.preNode = obj;
			obj.className="selectedMenu";
		}
	},
	/**
	 * 用来伸缩其子菜单
	 * 
	 * @param index
	 */
	extendSubNode : function(index) {
		for ( var i = 0; i < this.groupDatas.length; i++) {
			groupData = this.groupDatas[i];
			var panelContent = JBF.el(groupData["contentName"]);
			var icoObj = JBF.el(groupData["titleName"]);
			if (groupData["index"] == index) {
				this.setSubExtendInline(panelContent, icoObj);
			} else {
				//this.setSubExtendNone(panelContent, icoObj);
			}
		}
	},
	/**
	 * 设置子div为显示状态
	 * 
	 * @param panelContent
	 * @param icoObj
	 */
	setSubExtendInline : function(panelContent, icoObj) {
		if (panelContent) {
			var attribute = panelContent.attributes["isExtend"];
			if (attribute && attribute.nodeValue) {
				this.setSubExtendNone(panelContent, icoObj);
			}else {
				panelContent.style.display = "inline";
				icoObj.className="panelTitleOut_expend";
				panelContent.setAttribute("isExtend", 1);
			}
		}
	},
	/**
	 * 设置子div为隐藏状态
	 * 
	 * @param panelContent
	 * @param icoObj
	 */
	setSubExtendNone : function(panelContent, icoObj) {
		if (panelContent) {
			var attribute = panelContent.attributes["isExtend"];
			if (attribute && attribute.nodeValue) {
				panelContent.style.display = "none";
				icoObj.className='panelTitleOut';
				panelContent.setAttribute("isExtend", "");
			}
		}
	},
	searchMenuByCode : function(code) {
		for ( var i = 0; i < this.linkDatas.length; i++) {
			var linkData = this.linkDatas[i];
			if (code == linkData["code"]) {
				 return linkData["nodeName"] ;
			}
		}
	},
	selectedMenu:function(code){
		var nodeName=this.searchMenuByCode(code);
		this.setSelectedCss(JBF.el(nodeName));
	}
};